package com.jxb.bit;

/**
 * 类注释
 *
 * @author jiaobo
 * @date Created in 2024/12/24 20:55
 **/
public class Tets {

    public static void main(String[] args) {
        //实现数字翻倍或者减半
        int a = 2;
        int res = a>>1;
        int res1 = a<<1;
        System.out.println(res);
        System.out.println(res1);
        //交换2数
        int A = 3;
        int B = 4;
        A = A^B;
        B = A^B;//=(A^B)^B=A^(B^B)=A
        A^=B;//=A = A^B = A^(A^B) = (A^A)^B = B
    }

}
